{# SPDX-License-Identifier: Apache-2.0 #}
{
    "channel_id": "{{ channel.name }}",
    "read_set": {
        "groups": {
            "Application": {
                "groups": {
                    {% for member in channel.members %}
                    "{{ member.msp.id }}": {}{%- if not loop.last -%},{% endif %}
                    {% endfor %}
                }
            }
        },
        "values": {
            "Consortium": {
                "value": {
                    "name": "SampleConsortium"
                }
            }
        }
    },
    "write_set": {
        "groups": {
            "Application": {
                "groups": {
                    {% for member in channel.members %}
                    "{{ member.msp.id }}": {}{%- if not loop.last -%},{% endif %}
                    {% endfor %}
                },
                "mod_policy": "Admins",
                "policies": {
                    "Admins": {
                        "mod_policy": "Admins",
                        "policy": {
                            "type": 1,
                            "value": {
                                "rule": {
                                    "n_out_of": {
                                        "n": 1,
                                        "rules": [
                                            {% for member in channel.members %}
                                            {
                                                "signed_by": {{ loop.index0 }}
                                            }{%- if not loop.last -%},{% endif %}
                                            {% endfor %}
                                        ]
                                    }
                                },
                                "identities": [
                                    {% for member in channel.members %}
                                    {
                                        "principal_classification": "ROLE",
                                        "principal": {
                                            "msp_identifier": "{{ member.msp.id }}",
                                            "role": "ADMIN"
                                        }
                                    }{%- if not loop.last -%},{% endif %}
                                    {% endfor %}
                                ]
                            }
                        }
                    },
                    "Readers": {
                        "mod_policy": "Admins",
                        "policy": {
                            "type": 1,
                            "value": {
                                "rule": {
                                    "n_out_of": {
                                        "n": 1,
                                        "rules": [
                                            {% for member in channel.members %}
                                            {
                                                "signed_by": {{ loop.index0 }}
                                            }{%- if not loop.last -%},{% endif %}
                                            {% endfor %}
                                        ]
                                    }
                                },
                                "identities": [
                                    {% for member in channel.members %}
                                    {
                                        "principal_classification": "ROLE",
                                        "principal": {
                                            "msp_identifier": "{{ member.msp.id }}",
                                            "role": "MEMBER"
                                        }
                                    }{%- if not loop.last -%},{% endif %}
                                    {% endfor %}
                                ]
                            }
                        }
                    },
                    "Writers": {
                        "mod_policy": "Admins",
                        "policy": {
                            "type": 1,
                            "value": {
                                "rule": {
                                    "n_out_of": {
                                        "n": 1,
                                        "rules": [
                                            {% for member in channel.members %}
                                            {
                                                "signed_by": {{ loop.index0 }}
                                            }{%- if not loop.last -%},{% endif %}
                                            {% endfor %}
                                        ]
                                    }
                                },
                                "identities": [
                                    {% for member in channel.members %}
                                    {
                                        "principal_classification": "ROLE",
                                        "principal": {
                                            "msp_identifier": "{{ member.msp.id }}",
                                            "role": "MEMBER"
                                        }
                                    }{%- if not loop.last -%},{% endif %}
                                    {% endfor %}
                                ]
                            }
                        }
                    }
                },
                "values": {
                    "Capabilities": {
                        "mod_policy": "Admins",
                        "value": {
                            "capabilities": {
                                "V1_4_2": {}
                            }
                        }
                    }
                },
                "version": "1"
            }
        },
        "values": {
            "Consortium": {
                "value": {
                    "name": "SampleConsortium"
                }
            }
        }
    }
}